<template>
	<view class="advertise-container">
		<view class="list">
			<view class="item" v-for="(item,index) in data" :key="item._id" @click="navigateToUrl(item.href)">
				<image class="item-img" :src="item.remoteUrl?item.remoteUrl:(BasePath + item.img)"></image>
				<text>{{item.name}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "MyAdvertise",
		props: {
			data: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			navigateToUrl(url) {
				// uni.navigateTo({
				// 	// url: `/pages/webview/webview?url=${encodeURIComponent(url)}`
				// });
				window.open(url)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.advertise-container {
		.list {
			display: grid;
			grid-template-columns: repeat(5, 1fr);
			gap: 10rpx;
			padding: 20rpx;
		}

		.item {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			padding: 10rpx;
			cursor: pointer;
		}

		.item-img {
			width: 100rpx;
			height: 100rpx;
			object-fit: cover;
		}

		.item-title {
			margin-top: 10rpx;
			font-size: 14rpx;
			text-align: center;
		}
	}
</style>